var Ocr = {};
Ocr.contextpath = "";
Ocr.initPage = function(contextpath) {
    Ocr.contextpath = contextpath;
    layui.use(['form', 'layedit', 'laydate','upload'], function(){
        var form = layui.form
            ,layer = layui.layer
            ,upload = layui.upload;

        //自定义验证规则
        form.verify({
            userName: function(value){
                layedit.sync(editIndex);
            }
        });

        upload.render({
            elem : '#myfile',
            url : '/web2019/ocr/upload.action',
            accept : 'file' //普通文件
            ,
            before:function(){
            layer.load(1);
            },
            size: 6000,
            exts : 'jpg|png|gif|bmp|jpeg' //允许上传的文件后缀
            ,
            done : function(res) {//返回值接收
                layer.close(layer.index-1);
                if (res.code == "0000") {
                    if (res.code == "0000") {
                        layer.alert(res.message, { icon: 1, closeBtn: 0 ,area:['700px','auto']}, function (index) {
                            layer.closeAll();
                        });
                        // 打开 layer 弹窗


                    } else {
                        layer.alert(res.message);
                    }

                } else {
                    layer.msg('导入失败！', {}, function() {
//							location.reload();
                    });
                }
            }
        });
    });


}

